import {
  trendSummaryApi,
  trendBasicApi,
  trendRechargeApi,
  trendRechargeUserApi,
  trendWithdrawApi,
  trendWithdrawUserApi,
  trendNewUserApi,
  trendUpUserApi,
  trendUpAmountApi,
  trendActiveUserApi,
  trendBettingAmountApi,
  trendBettingWinApi,
  trendBettingEffectAmountApi,
  trendBettingUserApi,
  trendPromoUserApi,
  trendPromoAmountApi,

  realTimeTotalFirstRechargeApi,
  realTimeTotalFirstRechargeUserApi,
  trendOnlineApi,//暂时不确定接口对应功能
  trendGameProfitBasicApi,
  trendGameProfitApi,
} from '@/services/api/operationalTrend';
import {trendPromoInfoApi}  from '@/services/api/operationalRealTime';
const report = {
  state: {
    summary: undefined,//数据统计汇总
    basic: undefined,//趋势概要
    recharge: undefined,//实时统计
    rechargeUser: undefined,
    withdraw: undefined,
    withdrawUser: undefined,
    newUser: undefined,
    upAmountUnique: undefined,
    onPoints: undefined,
    activeUser: undefined,
    bettingAmount: undefined,
    bettingWin: undefined,
    bettingEffect: undefined,
    bettingUser: undefined,
    promoUser: undefined,
    promoAmount: undefined,
    gameProfitBasic: undefined,
    gameProfit: undefined,
    totalFirstSaveUser: undefined,
    totalRechargeMoney:undefined
  },

  mutations: {
    [types.SET_TREND_BASIC]: (state, data) => {
      state.basic = data
    },
    [types.SET_TREND_SUMMARY]: (state, data) => {
      state.summary = data
    },
    [types.SET_TREND_RECHARGE]: (state, data) => {
      state.recharge = data
    },
    [types.SET_TREND_RECHARGE_USER]: (state, data) => {
      state.rechargeUser = data
    },
    [types.SET_TREND_WITHDRAW]: (state, data) => {
      state.withdraw = data
    },
    [types.SET_TREND_WITHDRAW_USER]: (state, data) => {
      state.withdrawUser = data
    },
    [types.SET_TREND_NEW_USER]: (state, data) => {
      state.newUser = data
    },
    [types.SET_TREND_UP_USER]: (state, data) => {
      state.upAmountUnique = data
    },
    [types.SET_TREND_UP_AMOUNT]: (state, data) => {
      state.onPoints = data
    },
    [types.SET_TREND_ACTIVE_USER]: (state, data) => {
      state.activeUser = data
    },
    [types.SET_TREND_BETTING_AMOUNT]: (state, data) => {
      state.bettingAmount = data
    },
    [types.SET_TREND_BETTING_WIN]: (state, data) => {
      state.bettingWin = data
    },
    [types.SET_TREND_BETTING_EFFECT_AMOUNT]: (state, data) => {
      state.bettingEffect = data
    },
    [types.SET_TREND_BETTING_USER]: (state, data) => {
      state.bettingUser = data
    },
    [types.SET_TREND_PROMO_USER]: (state, data) => {
      state.promoUser = data
    },
    [types.SET_TREND_PROMO_AMOUNT]: (state, data) => {
      state.promoAmount = data
    },

    [types.SET_TREND_GAME_PROFIT_BASIC]: (state, data) => {
      state.gameProfitBasic = data
    },
    [types.SET_TREND_GAME_PROFIT]: (state, data) => {
      state.gameProfit = data
    },
    [types.SET_TOTALREAL_TIME_RIRSTRECHARGE_USER]: (state, data) => {
      state.totalFirstSaveUser = data
    },
    [types.SET_TOTALREAL_TIME_FIRSTRECHARGE_MONEY]: (state, data) => {
      state.totalRechargeMoney = data
    },
  },

  actions: {
    async [types.GET_TREND_BASIC]({commit},params) {
      const [result, data] = await trendBasicApi(params);
      if(result){
        commit(types.SET_TREND_BASIC,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_SUMMARY]({commit},params) {
      const [result, data] = await trendSummaryApi(params);
      if(result){
        commit(types.SET_TREND_SUMMARY,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_RECHARGE]({commit},params) {
      const [result, data] = await trendRechargeApi(params);
      if(result){
        commit(types.SET_TREND_RECHARGE,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_RECHARGE_USER]({commit},params) {
      const [result, data] = await trendRechargeUserApi(params);
      if(result){
        commit(types.SET_TREND_RECHARGE_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_WITHDRAW]({commit},params) {
      const [result, data] = await trendWithdrawApi(params);
      if(result){
        commit(types.SET_TREND_WITHDRAW,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_WITHDRAW_USER]({commit},params) {
      const [result, data] = await trendWithdrawUserApi(params);
      if(result){
        commit(types.SET_TREND_WITHDRAW_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_NEW_USER]({commit},params) {
      const [result, data] = await trendNewUserApi(params);
      if(result){
        commit(types.SET_TREND_NEW_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_UP_USER]({commit},params) {
      const [result, data] = await trendUpUserApi(params);
      if(result){
        commit(types.SET_TREND_UP_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_UP_AMOUNT]({commit},params) {
      const [result, data] = await trendUpAmountApi(params);
      if(result){
        commit(types.SET_TREND_UP_AMOUNT,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_ACTIVE_USER]({commit},params) {
      const [result, data] = await trendActiveUserApi(params);
      if(result){
        commit(types.SET_TREND_ACTIVE_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_BETTING_AMOUNT]({commit},params) {
      const [result, data] = await trendBettingAmountApi(params);
      if(result){
        commit(types.SET_TREND_BETTING_AMOUNT,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_BETTING_WIN]({commit},params) {
      const [result, data] = await trendBettingWinApi(params);
      if(result){
        commit(types.SET_TREND_BETTING_WIN,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_BETTING_EFFECT_AMOUNT]({commit},params) {
      const [result, data] = await trendBettingEffectAmountApi(params);
      if(result){
        commit(types.SET_TREND_BETTING_EFFECT_AMOUNT,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_BETTING_USER]({commit},params) {
      const [result, data] = await trendBettingUserApi(params);
      if(result){
        commit(types.SET_TREND_BETTING_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_PROMO_USER]({commit},params) {
      const [result, data] = await trendPromoUserApi(params);
      if(result){
        commit(types.SET_TREND_PROMO_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_PROMO_AMOUNT]({commit},params) {
      const [result, data] = await trendPromoAmountApi(params);
      if(result){
        commit(types.SET_TREND_PROMO_AMOUNT,data)
      }
      return {result, data}
    },

    async [types.GET_TREND_GAME_PROFIT_BASIC]({commit},params) {
      const [result, data] = await trendGameProfitBasicApi(params);
      if(result){
        commit(types.SET_TREND_GAME_PROFIT_BASIC,data)
      }
      return {result, data}
    },
    async [types.GET_TREND_GAME_PROFIT]({commit},params) {
      const [result, data] = await trendGameProfitApi(params);
      if(result){
        commit(types.SET_TREND_GAME_PROFIT,data)
      }
      return {result, data}
    },
    async [types.GET_TOTALREAL_TIME_RIRSTRECHARGE_USER]({commit},params) {
      const [result, data] = await realTimeTotalFirstRechargeUserApi(params);
      if(result){
        commit(types.SET_TOTALREAL_TIME_RIRSTRECHARGE_USER,data)
      }
      return {result, data}
    },
    async [types.GET_TOTALREAL_TIME_FIRSTRECHARGE_MONEY]({commit},params) {
      const [result, data] = await realTimeTotalFirstRechargeApi(params);
      if(result){
        commit(types.SET_TOTALREAL_TIME_FIRSTRECHARGE_MONEY,data)
      }
      return {result, data}
    },

  }
}

export default report
